package cn.imu.appdevexperiment2020.cch.adapter;

import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.List;

import cn.imu.appdevexperiment2020.R;
import cn.imu.appdevexperiment2020.cch.retrofit.bean.GetByUserNameResultBean;
import cn.imu.appdevexperiment2020.cch.retrofit.bean.ListResultBean;

/**
 * 描述:
 *
 * @author chenconghua
 * @version 1.0
 * @create 2022-12-25 17:35
 */
public class ClassGetUserAdapter extends RecyclerView.Adapter<ClassGetUserAdapter.ViewHolder> {

    private List<GetByUserNameResultBean.DataBean> mclassList;

    static class ViewHolder extends RecyclerView.ViewHolder{
        TextView name;

        public ViewHolder(@NonNull View itemView) {
            super(itemView);
            name =(TextView) itemView.findViewById(R.id.tv_left_name);
        }
    }
    public ClassGetUserAdapter(List<GetByUserNameResultBean.DataBean> list){
        mclassList=list;
    }
    @NonNull
    @Override
    public ClassGetUserAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
        View view= LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.class_item,viewGroup,false);
        ClassGetUserAdapter.ViewHolder holder = new ClassGetUserAdapter.ViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(@NonNull ClassGetUserAdapter.ViewHolder viewHolder, int i) {
        GetByUserNameResultBean.DataBean listResultBean = mclassList.get(i);
        Log.e("cch",listResultBean.getNickName());
        viewHolder.name.setText(listResultBean.getNickName().toString());

    }

    @Override
    public int getItemCount() {
        return mclassList.size();
    }
}
